package com.mnyc.system.enmu.system;


public enum ProcessStatusEnum implements DictEnum {
    DRAFT("草稿", "0"),
    AUDIT("审批中", "1"),
    PASS("已通过", "2"),
    REJECT("已驳回", "3"),
    ARCHIVE("已归档", "6"),
    TERMINATE("已终止", "9");

    String code;
    String label;

    ProcessStatusEnum(String label, String code) {
        this.code = code;
        this.label = label;
    }

    @Override
    public String getCode() {
        return code;
    }

    public String getLabel() {
        return label;
    }

    public static ProcessStatusEnum getByCode(String code) {
        return DictEnum.baseGetByCode(ProcessStatusEnum.class, code);
    }

    public static boolean canDelete(String code) {
        ProcessStatusEnum byCode = getByCode(code);
        switch (byCode) {
            case DRAFT://草稿
            case REJECT://已驳回
            case TERMINATE://已终止
                return true;
            default:
                return false;
        }
    }
}
